<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>Ztree的整合</title>
		<script type="text/javascript" src="../js/jquery-1.8.3.js" ></script>
		<script type="text/javascript" src="../js/easyui/jquery.easyui.min.js" ></script>
		<script type="text/javascript" src="../js/easyui/locale/easyui-lang-zh_CN.js" ></script>
		<link rel="stylesheet" href="../js/easyui/themes/default/easyui.css" />
		<link rel="stylesheet" href="../js/easyui/themes/icon.css" />
		<script src="../js/ztree/jquery.ztree.all-3.5.js"  
                               type="text/javascript" charset="utf-8"></script> 
 	 	<link rel="stylesheet" type="text/css" href="../js/ztree/zTreeStyle.css"/> 
 	 	<script>
 	 	
 	 		$(function(){
 	 			var setting={
						data:{
							simpleData:{
								enable:true
							}
						},
						
						callback:{
							onClick:function(event, treeId, treeNode) {
									 var content='<div style="width:100%;height:100%;overflow:hidden;"><iframe " scrolling="auto" style="width:100%;height:100%;border:0;"  src='+treeNode.page+'></iframe></div>';
									 alert(content);
									 if(treeNode.page!=undefined&& treeNode.page != ""){
									 	if($("#mytabs").tabs('exists',treeNode.name)){
									 		$("#mytabs").tabs('select',treeNode.name);	
									 	 }else{
										 	$("#mytabs").tabs('add',{
											title:treeNode.name,
											content: content,
											closable :true
									         });
									      }   
								    }
							 }
						}
				 };
 	 		
 	 		
					var nodes = [
								{id:1, pId:0, name: "父节点1"},
								{id:11, pId:1, name: "子节点1"},
								{id:12, pId:1, name: "子节点2"},
								{id:2, pId:0, name: "父节点2"},
								{id:13,pId:2,name:"传智播客",page:"http://www.itcast.cn"},
								{id:14,pId:2,name:"百度",page:"https://www.baidu.com"}
					];
								
					$.fn.zTree.init($("#baseMenu"), setting, nodes);
					
					$("#mytabs").tabs({
					onContextMenu: function(e, title,index){
						// 阻止默认菜单显示
						e.preventDefault();
						
						// 显示自定义右键菜单
						$("#mm").menu('show',{
							left : e.pageX,
							top : e.pageY
						});
					}
				});
 	 		});
		 	 	
 	 	</script>
 	 	
	</head>
	<body class="easyui-layout">
		<div data-options="region:'north',title:'North Title',split:true" style="height:100px;">北部</div> 

		<div data-options="region:'south',title:'South Title',split:true" style="height:100px;">南部</div> 
		
		<div data-options="region:'east',iconCls:'icon-reload',title:'East',split:true" style="width:100px;">东部</div> 
		
		<div data-options="region:'west',title:'West',split:true" style="width:180px;">西部
			
			<div class="easyui-accordion" data-options="fit:true"> 
					<div data-options="title:'基础菜单'">
						<ul id="baseMenu" class="ztree">面板一</ul>
					</div>
					<div data-options="title:'系统菜单'">面板二</div>
			</div> 
		</div> 
		
		<div data-options="region:'center',title:'center title'" style="padding:5px;background:#eee;">中部
			<div id="mytabs" class="easyui-tabs" data-options="fit:true"> 
				<div title="Tab1" data-options="closable:true">tab1</div> 
				<div title="Tab2" data-options="closable:true">tab2</div> 
			</div> 

		</div> 
		<div id="mm" class="easyui-menu" style="width:120px;"> 
			<div>关闭当前窗口</div>
			<div>关闭其他窗口</div>
			<div class="menu-sep"></div>
			<div data-options="iconCls:'icon-cancel'">关闭全部窗口</div>
		</div>

	  
	</body>
</html>
